package com.itheima.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.mapper.UserMapper;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：mengw9
 * @date ：Created By 2020/9/17 21:06
 * @description：
 * @version:
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public List<User> findAll() {
        return this.userMapper.findAll();
    }

    @Override
    public void addUser(User user) {
        this.userMapper.addUser(user);
    }

    @Override
    public void updateUser(User user) {
        this.userMapper.updateUser(user);
    }

    @Override
    public void deteUserById(Integer id) {
        this.userMapper.deteUserById(id);
    }

    @Override
    public Page<User> queryUser(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        Page<User> pages = (Page<User>)this.userMapper.queryPage();
        return pages;

    }
}
